def __convert_str__(s:str, t:str, convert):
    if s is None: return None
    if not isinstance(s, str):
        raise ValueError('parameter s must be a string value.')
    try: return convert(s)
    except: raise ValueError(f'can not convert "{s}" to {t} value')



def __str_to_bool__(s:str) -> bool:
    low = s.lower()

    if low == 'true': return True
    if low == 'false': return False

    if low == 't': return True
    if low == 'f': return False

    if low == 'y': return True
    if low == 'n': return False

    if low == 'yes': return True
    if low == 'no': return False

    if low == '1': return True
    if low == '0': return False

    raise ValueError()

def str_to_bool(s:str) -> bool:
    return __convert_str__(s, 'boolean', __str_to_bool__)



def __str_to_int__(s:str) -> int:
    return int(s)

def str_to_int(s:str) -> int:
    return __convert_str__(s, 'int', __str_to_int__)



def __str_to_float__(s:str) -> float:
    return float(s)

def str_to_float(s:str) -> float:
    return __convert_str__(s, 'float', __str_to_float__)




def bool_to_str(b:bool) -> str:
    return str(b)

def int_to_str(b:int) -> str:
    return str(b)

def float_to_str(b:float) -> str:
    return str(b)